package com.czy.seed.mvc.home.mapper;
import com.czy.seed.mvc.home.entity.WarnInfo;
import com.czy.seed.mybatis.base.mapper.BaseMapper;
import com.czy.seed.mybatis.config.mybatis.annotations.AutoMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@AutoMapper
public interface WarnInfoMapper extends BaseMapper<WarnInfo> {
    @Select("SELECT * FROM (\n" +
            "select sum(od.ZJ) as amount, m.NAME,ord.CREATOR_USERID as userId, u. NAME as nameType from \n" +
            "purchase_detailed_list od join purchase_orders ord on od.SSDD_GLGX=ord.id  join seed_sys_user u on u.id=ord.CREATOR_USERID\n" +
            "join menu m on  m.id=od.GOODS_TYPE \n" +
            "GROUP BY od.GOODS_TYPE) AS a\n" +
            "WHERE a.amount >#{max}")
    List<WarnInfo> selectStatistics(@Param("max") Long max);
}
